<%--
  @author Tharanga Punchihewa
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="s" uri="/struts-tags" %>

<script type="text/javascript ">
    $(document).ready(function() {
        $('.organization-list').dataTable({
            "oTableTools": {
                "aButtons": [
                    {
                        "sExtends": "print",
                        "bShowAll": true
                    }
                ]
            }
        });
    });
</script>
<div id="land-registration-module-home-title" class="module-home-title">
    <s:a href="landInterests.do"><img src="${pageContext.request.contextPath}/images/land-reg.png"
                                             alt="Land Registration"><span><s:label
            value="Land Interests"/></span></s:a>
</div>
<s:if test="organizationsList .size()>0">
    <table class="width-100 margin-10-auto table organization-list">
        <thead>
        <tr class="center-align table-header">
            <th class="width-450-px"><s:label value="%{getText('organization_name.label')}"/></th>
            <th><s:label value="%{getText('active.label')}"/></th>
            <th><s:label value="%{getText('edit.label')}"/></th>
            <th><s:label value="%getText('approve_orpii_changes.label')"/></th>
        </tr>
        </thead>
        <tbody>
        <s:iterator status="status1" value="organizationsList">
            <tr>
                <td class="center-align">
                    <s:if test="language=='si'">
                        <s:property value="organizationNameSi"/>
                    </s:if> <s:elseif test="language=='en'">
                    <s:property value="organizationNameEn"/>
                </s:elseif><s:elseif test="language=='ta'">
                    <s:property value="organizationNameTa"/>
                </s:elseif>
                </td>
                <td class="center-align">
                    <s:if test="status.ordinal()==1">
                        <s:url id="activeOrganization" action="activeOrganization">
                            <s:param name="organizationId" value="id"/>
                        </s:url>
                        <s:a href="%{activeOrganization}">
                            <img src="<s:url value='/images/approve.png'/>" class="image-icon" title="Active"/>
                        </s:a>
                    </s:if>
                    <s:if test="status.ordinal()== 0">
                        <s:url id="inactiveOrganization" action="inactiveOrganization">
                            <s:param name="organizationId" value="id"/>
                        </s:url>
                        <s:a href="%{inactiveOrganization}">
                            <img src="<s:url value='/images/reject.png'/>" class="image-icon" title="Inactive"/>
                        </s:a>
                    </s:if>
                </td>
                <td class="center-align">
                    <s:if test="status.ordinal()==0">
                        <s:url id="initEditOrganizationInfo" action="initEditOrganizationInfo">
                            <s:param name="organizationId" value="id"/>
                            <s:param name="editMode" value="3"/>
                        </s:url>
                        <s:a href="%{initEditOrganizationInfo}">
                            <img src="<s:url value='/images/modify-form.png'/>" class="image-icon" title="Edit"/>
                        </s:a>
                    </s:if>
                </td>
                <td class="center-align">
                    <s:if test="type.ordinal()==2">
                        <s:url id="initRegisterOrganization" action="initRegisterOrganization">
                            <s:param name="organizationId" value="id"/>
                        </s:url>
                        <s:a href="%{initRegisterOrganization}">
                            <img src="<s:url value='/images/modify-form.png'/>" class="image-icon" title="Register"/>
                        </s:a>
                    </s:if>
                </td>
            </tr>
        </s:iterator>
        </tbody>
    </table>
</s:if>
